home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / filesystem.squashfs / usr / share / system-config-printer / troubleshoot / base.pyc (.txt) < prev    next >
Python Compiled Bytecode  |  2009-10-28  |  4KB  |  101 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. import gtk
  5. from gettext import gettext as _
  6. from debug import *
  7. __all__ = [
  8.     'gtk',
  9.     '_',
  10.     'debugprint',
  11.     'get_debugging',
  12.     'set_debugging',
  13.     'Question',
  14.     'Multichoice',
  15.     'TEXT_start_print_admin_tool']
  16. TEXT_start_print_admin_tool = _('To start this tool, select System->Administration->Printing from the main menu.')
  17.  
  18. class Question:
  19.     
  20.     def __init__(self, troubleshooter, name = None):
  21.         self.troubleshooter = troubleshooter
  22.         if name:
  23.             
  24.             self.__str__ = lambda : name
  25.         
  26.  
  27.     
  28.     def display(self):
  29.         '''Returns True if this page should be displayed, or False
  30.         if it should be skipped.'''
  31.         return True
  32.  
  33.     
  34.     def connect_signals(self, handler):
  35.         pass
  36.  
  37.     
  38.     def disconnect_signals(self):
  39.         pass
  40.  
  41.     
  42.     def can_click_forward(self):
  43.         return True
  44.  
  45.     
  46.     def collect_answer(self):
  47.         return { }
  48.  
  49.     
  50.     def cancel_operation(self):
  51.         pass
  52.  
  53.     
  54.     def initial_vbox(self, title = '', text = ''):
  55.         vbox = gtk.VBox()
  56.         vbox.set_border_width(12)
  57.         vbox.set_spacing(12)
  58.         if title:
  59.             s = '<span weight="bold" size="larger">' + title + '</span>\n\n'
  60.         else:
  61.             s = ''
  62.         s += text
  63.         label = gtk.Label(s)
  64.         label.set_alignment(0, 0)
  65.         label.set_line_wrap(True)
  66.         label.set_use_markup(True)
  67.         vbox.pack_start(label, False, False, 0)
  68.         return vbox
  69.  
  70.  
  71.  
  72. class Multichoice(Question):
  73.     
  74.     def __init__(self, troubleshooter, question_tag, question_title, question_text, choices, name = None):
  75.         Question.__init__(self, troubleshooter, name)
  76.         page = self.initial_vbox(question_title, question_text)
  77.         choice_vbox = gtk.VBox()
  78.         choice_vbox.set_spacing(6)
  79.         page.pack_start(choice_vbox, False, False, 0)
  80.         self.question_tag = question_tag
  81.         self.widgets = []
  82.         for choice, tag in choices:
  83.             button = gtk.RadioButton(label = choice)
  84.             if len(self.widgets) > 0:
  85.                 button.set_group(self.widgets[0][0])
  86.             
  87.             choice_vbox.pack_start(button, False, False, 0)
  88.             self.widgets.append((button, tag))
  89.         
  90.         troubleshooter.new_page(page, self)
  91.  
  92.     
  93.     def collect_answer(self):
  94.         for button, answer_tag in self.widgets:
  95.             if button.get_active():
  96.                 return {
  97.                     self.question_tag: answer_tag }
  98.         
  99.  
  100.  
  101.